//
//  GGCarGroupModel.m
//  GGCar
//
//  Created by 热带雨林 on 2020/3/13.
//  Copyright © 2020 热带雨林. All rights reserved.
//
@class GGCarDetailModel;
#import "GGCarGroupModel.h"
#import "GGCarDetailModel.h"

@implementation GGCarGroupModel

- (instancetype)initGroupWithDic:(NSDictionary *)dic{
    if(self = [super init]){
        _cars = dic[@"cars"];
        _title = dic[@"title"];
        //数组中嵌套数组
        NSMutableArray *arrayM = [[NSMutableArray alloc]init];
        //此处循环遍历出model数组中的model
        for (NSDictionary *carDic  in _cars) {
            GGCarDetailModel *carM = [GGCarDetailModel carWithDic:carDic];
            [arrayM addObject:carM];
        }
        _cars = arrayM.copy;
    }
    return self;
}
+ (instancetype)groupWithDic:(NSDictionary *)dic{
    
    return [[self alloc]initGroupWithDic:dic];
}

@end
